home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / p4 / p4-1_2a.lha / p4-1.2a / Makefile < prev    next >
Makefile  |  1992-11-07  |  4KB  |  165 lines

  1. # top level makefile for p4
  2.  
  3. SHELL=/bin/sh
  4.  
  5. MFLAGS = 
  6. #MFLAGS = -i    # for alliant fx/8
  7.   
  8. P4_DIRS = util lib alog usc include bin servers 
  9.  
  10. EXAMPLES_DIRS = contrib messages monitors
  11.  
  12. ALL_DIRS = $(P4_DIRS) $(EXAMPLES_DIRS) lib_f messages_f contrib_f doc usc/usctest
  13.  
  14. DIRS = $(ALL_DIRS)
  15.  
  16. RM = /bin/rm
  17.  
  18. all:
  19.     @echo making p4 for machine=$(MACHINE)
  20.     @make makefiles MACHINE=$(MACHINE)
  21.     @make $(MFLAGS) links MACHINE=$(MACHINE)
  22.     @for dir in $(DIRS) ;\
  23.       do \
  24.       echo " " ;\
  25.       echo making p4 in directory $$dir ;\
  26.       (cd $$dir; make $(MFLAGS) default) ;\
  27.       done 
  28.  
  29. p4:
  30.     @echo making p4 for machine=$(MACHINE)
  31.     @make makefiles MACHINE=$(MACHINE)
  32.     @make $(MFLAGS) links MACHINE=$(MACHINE)
  33.     @for dir in $(P4_DIRS) ;\
  34.       do \
  35.       echo " " ;\
  36.       echo making p4 in directory $$dir ;\
  37.       (cd $$dir; make $(MFLAGS) default) ;\
  38.       done 
  39.  
  40. makefiles:
  41.     @(cd util; make -f makefile.proto defs.MD MACHINE=$(MACHINE))
  42.     @echo "making Makefiles in " $(DIRS)
  43.     @for dir in $(DIRS) ;\
  44.       do \
  45.       cat util/defs.MD $$dir/makefile.proto > $$dir/Makefile ;\
  46.       done 
  47.  
  48. #  @echo "#define  P4_$_MACHINE_TYPE \"$(MACHINE)\"" >> lib/p4_config.h
  49. config_hdr:
  50.     @echo "#define P4_COMPILED_TIME  \"`date`\"" > lib/p4_config.h
  51.     @echo "#define  P4_MACHINE_TYPE \"$(MACHINE)\"" >> lib/p4_config.h
  52.     @echo "#ifndef  $(MACHINE)" >> lib/p4_config.h
  53.     @echo "#define  $(MACHINE)" >> lib/p4_config.h
  54.     @echo "#endif  "            >> lib/p4_config.h
  55.     @cat OPTIONS >> lib/p4_config.h
  56.  
  57. links:
  58.     @if [ -f lib/alog.h ] ;\
  59.     then\
  60.         true ;\
  61.     else\
  62.         ln alog/alog*.h lib ;\
  63.         ln alog/alog*.h include ;\
  64.     fi
  65.     @if [ -f lib/usc.h ] ;\
  66.     then\
  67.         true ;\
  68.     else\
  69.         ln usc/usc*.h lib ;\
  70.         ln usc/usc*.h include ;\
  71.     fi
  72.     @if [ -f lib/p4_config.h ] ;\
  73.     then\
  74.         true ;\
  75.     else\
  76.         make config_hdr MACHINE=$(MACHINE) ;\
  77.     fi
  78.     @if [ -f include/p4.h ] ;\
  79.     then\
  80.         true ;\
  81.     else\
  82.         ln lib/p4*.h include ;\
  83.     fi
  84.     @if [ -f messages_f/p4f.h ] ;\
  85.     then\
  86.         true ;\
  87.     else\
  88.         ln lib_f/p4f.h messages_f ;\
  89.     fi
  90.     @if [ -f contrib_f/p4f.h ] ;\
  91.     then\
  92.         true ;\
  93.     else\
  94.         ln lib_f/p4f.h contrib_f ;\
  95.     fi
  96.  
  97. clean:  
  98.     @for dir in $(DIRS) ;\
  99.       do \
  100.       echo cleaning $$dir ;\
  101.       (cd $$dir; make clean) ;\
  102.       done
  103.     $(RM) -f *~ *.o *.bak
  104.  
  105. dist:    realclean   
  106.  
  107. realclean:
  108.     $(RM) -f *~ *.o *.bak
  109.     @for dir in $(DIRS) ;\
  110.       do \
  111.       echo cleaning $$dir ;\
  112.       (cd $$dir; make realclean) ;\
  113.       done
  114.  
  115. Makefiles: makefiles
  116.  
  117. INSTALLDIR = ./$(MACHINE)
  118. install:
  119.     @echo installing p4 in $(INSTALLDIR)
  120.     @if [ -d $(INSTALLDIR) ] ;\
  121.     then\
  122.         echo 'using existing directory $(INSTALLDIR)' ;\
  123.     else\
  124.         mkdir $(INSTALLDIR) ;\
  125.     fi
  126.     @cp Makefile $(INSTALLDIR)
  127.     @mkdir $(INSTALLDIR)/util
  128.     @cp util/* $(INSTALLDIR)/util
  129.     @mkdir $(INSTALLDIR)/include
  130.     @cp include/*.h $(INSTALLDIR)/include
  131.     @mkdir $(INSTALLDIR)/lib
  132.     @cp lib/libp4.a lib/p4_cmain.o $(INSTALLDIR)/lib
  133.     @grep RANLIB util/defs.MD > $(INSTALLDIR)/lib/makeranlib
  134.     @echo "doran:" >> $(INSTALLDIR)/lib/makeranlib
  135.     @echo "    $$(RANLIB) libp4.a" >> $(INSTALLDIR)/lib/makeranlib
  136.     @(cd  $(INSTALLDIR)/lib; make -f makeranlib doran; $(RM) makeranlib)
  137.     @mkdir $(INSTALLDIR)/lib_f
  138.     @cp lib_f/libp4_f.a lib_f/p4_fmain.o lib_f/*.h $(INSTALLDIR)/lib_f
  139.     @grep RANLIB util/defs.MD > $(INSTALLDIR)/lib_f/makeranlib
  140.     @echo "doran:" >> $(INSTALLDIR)/lib_f/makeranlib
  141.     @echo "    $$(RANLIB) libp4_f.a" >> $(INSTALLDIR)/lib_f/makeranlib
  142.     @(cd  $(INSTALLDIR)/lib_f; make -f makeranlib doran; $(RM) makeranlib)
  143.     @mkdir $(INSTALLDIR)/bin
  144.     @cp bin/* $(INSTALLDIR)/bin
  145.     @mkdir $(INSTALLDIR)/examples
  146.     @cp messages/sr_test.c messages/sr_user.h  \
  147.       messages/systest.c messages/makefile.proto \
  148.       messages/runcube messages/rundelta \
  149.       messages/procgroup $(INSTALLDIR)/examples
  150.     @sed -e "s@P4_HOME_DIR = ..@P4_HOME_DIR = $(INSTALLDIR)@" \
  151.       $(INSTALLDIR)/examples/makefile.proto >  $(INSTALLDIR)/temp
  152.     @mv $(INSTALLDIR)/temp  $(INSTALLDIR)/examples/makefile.proto
  153.     @make makefiles DIRS=$(INSTALLDIR)/examples
  154.     @(cd $(INSTALLDIR)/examples; make sr_test systest)
  155.     @mkdir $(INSTALLDIR)/examples_f
  156.     @cp messages_f/systest.f messages_f/p4f.h  \
  157.       messages_f/makefile.proto \
  158.       messages_f/procgroup $(INSTALLDIR)/examples_f
  159.     @sed -e "s@P4_HOME_DIR = ..@P4_HOME_DIR = $(INSTALLDIR)@" \
  160.       $(INSTALLDIR)/examples_f/makefile.proto >  $(INSTALLDIR)/temp
  161.     @mv $(INSTALLDIR)/temp  $(INSTALLDIR)/examples_f/makefile.proto
  162.     @make makefiles DIRS=$(INSTALLDIR)/examples_f
  163.     @(cd $(INSTALLDIR)/examples_f; make systest)
  164.     @echo installed p4 in $(INSTALLDIR)
  165.